using System;
using System.ComponentModel;
using System.Transactions;

using SIS.ENT;
using SIS.DAL;


namespace SIS.BLL {

/// <summary>
/// The StandarLevelSubjectTableManager class is responsible for managing BO.StandarLevelSubjectTable objects in the system.
/// </summary>
[DataObjectAttribute()]
public class StandarLevelSubjectTableManager
  {

#region "Public Methods"

/// <summary>
/// Gets a list with all StandarLevelSubjectTable objects in the database.
/// </summary>
/// <returns>A list with all StandarLevelSubjectTable from the database when the database contains any, or null otherwise.</returns>
[DataObjectMethod(DataObjectMethodType.Select, true)]
public static StandarLevelSubjectTableList GetList(){
return StandarLevelSubjectTableDB.GetList();
}

/// <summary>
/// Gets a single StandarLevelSubjectTable from the database without its data.
/// </summary>
/// <param name="subjectKey">The SubjectKey of the StandarLevelSubjectTable in the database.</param>
/// <returns>A StandarLevelSubjectTable object when the SubjectKey exists in the database, or <see langword="null"/> otherwise.</returns>
[DataObjectMethod(DataObjectMethodType.Select, false)]
public static StandarLevelSubjectTable GetItem(int subjectKey){
return GetItem(subjectKey, false);
}

/// <summary>
/// Gets a single StandarLevelSubjectTable from the database.
/// </summary>
/// <param name="subjectKey">The SubjectKey of the StandarLevelSubjectTable in the database.</param>
/// <param name="getStandarLevelSubjectTableRecords">Determines whether to load all associated StandarLevelSubjectTable records as well.</param>
/// <returns>
/// A StandarLevelSubjectTable object when the SubjectKey exists in the database, or <see langword="null"/> otherwise.
/// </returns>
[DataObjectMethod(DataObjectMethodType.Select, false)]
public static StandarLevelSubjectTable GetItem(int subjectKey, bool getStandarLevelSubjectTableRecords){
StandarLevelSubjectTable myStandarLevelSubjectTable = StandarLevelSubjectTableDB.GetItem(subjectKey);
return myStandarLevelSubjectTable;
}

/// <summary>
/// Saves a StandarLevelSubjectTable in the database.
/// </summary>
/// <param name="myStandarLevelSubjectTable">The StandarLevelSubjectTable instance to save.</param>
/// <returns>The new SubjectKey if the StandarLevelSubjectTable is new in the database or the existing SubjectKey when an item was updated.</returns>
[DataObjectMethod(DataObjectMethodType.Update, true)]
public static int Save(StandarLevelSubjectTable myStandarLevelSubjectTable){
using (TransactionScope myTransactionScope = new TransactionScope()){
int standarLevelSubjectTableSubjectKey = StandarLevelSubjectTableDB.Save(myStandarLevelSubjectTable);

//  Assign the StandarLevelSubjectTable its new (or existing SubjectKey).
myStandarLevelSubjectTable.SubjectKey = standarLevelSubjectTableSubjectKey;

myTransactionScope.Complete();

return standarLevelSubjectTableSubjectKey;
}
}

/// <summary>
/// Deletes a StandarLevelSubjectTable from the database.
/// </summary>
/// <param name="myStandarLevelSubjectTable">The StandarLevelSubjectTable instance to delete.</param>
/// <returns>Returns true when the object was deleted successfully, or false otherwise.</returns>
[DataObjectMethod(DataObjectMethodType.Delete, true)]
public static bool Delete(StandarLevelSubjectTable myStandarLevelSubjectTable){
return StandarLevelSubjectTableDB.Delete(myStandarLevelSubjectTable.SubjectKey);
}

#endregion

}

}
